import axios from 'axios'

const apiClient = axios.create({
  baseURL: '/', // 替换为你的 API 基础 URL
  headers: {
    'Content-Type': 'application/json',
  },
})

export interface AskRequest {
  data: string // 根据实际情况调整类型
}

export interface AskResponse {
  message: string // 根据实际情况调整类型
}

export const askApi = async (params: AskRequest): Promise<AskResponse> => {
  try {
    const response = await apiClient.post<AskResponse>('/api/ask', params)
    console.log('response', response)
    return response.data
  } catch (error) {
    throw new Error(`Failed to call ask API:${error}`)
  }
}
